package cn.jtfadmin.support.modules.mail.dto;

import java.io.Serializable;
import java.util.List;

/**
 * 附件电子邮件
 */
public class AttachmentSendMailDTO extends TextSendMailDTO {


    /**
     * 附件
     */
    protected List<AttachmentDTO> attachmentList;


    public AttachmentSendMailDTO() {
    }

    /**
     * 构造函数
     * @param smtpHostName smtp 域名， 非空
     * @param smtpPort smtp 端口号, ssl 465 ,STARTTLS 25, 可 null
     * @param authenticatorUsername 用户名 非空
     * @param authenticatorPassword 密码 非空
     * @param sslOnConnect 是否ssl
     * @param from 发送人 非空
     * @param subject  主题 非空
     * @param toList 接收人集合，非空
     * @param replyTo  回复人 可以为空集合，但不可为null
     * @param msg 发送的文本 不可空
     * @param attachmentList 附件集合 可null
     */
    public AttachmentSendMailDTO(String smtpHostName, Integer smtpPort, String authenticatorUsername, String authenticatorPassword, boolean sslOnConnect, MailAddressDTO from, String subject, List<MailAddressDTO> toList, List<MailAddressDTO> replyTo, String msg, List<AttachmentDTO> attachmentList) {
        super(smtpHostName, smtpPort, authenticatorUsername, authenticatorPassword, sslOnConnect, from, subject, toList, replyTo, msg);
        this.attachmentList = attachmentList;
    }

    public List<AttachmentDTO> getAttachmentList() {
        return attachmentList;
    }

    public void setAttachmentList(List<AttachmentDTO> attachmentList) {
        this.attachmentList = attachmentList;
    }

    /**
     * 附件信息
     */
    public static class AttachmentDTO implements Serializable{

        /**
         * 附件名称
         */
        protected String name;

        /**
         * 附件描述
         */
        protected String description;

        /**
         * 附件路径
         */
        protected String path;

        /**
         * 附件url
         */
        protected String url;

        public AttachmentDTO() {
        }

        /**
         * 附件, 路径和url 不能同时为空，首先选中url ,如果url为空，则选用路径
         * @param name 附件名称 非空
         * @param description 附件描述 非空
         * @param path 附件路径
         * @param url 附件url
         */
        public AttachmentDTO(String name, String description, String path, String url) {
            this.name = name;
            this.description = description;
            this.path = path;
            this.url = url;
        }

        public String getName() {
            return name;
        }

        public void setName(String name) {
            this.name = name;
        }

        public String getDescription() {
            return description;
        }

        public void setDescription(String description) {
            this.description = description;
        }

        public String getPath() {
            return path;
        }

        public void setPath(String path) {
            this.path = path;
        }

        public String getUrl() {
            return url;
        }

        public void setUrl(String url) {
            this.url = url;
        }
    }
}
